#include <cstdio>
#include <cstring>
#include <cstdio>

struct Matrix
{
    int n, m;
    double a[ 101 ][ 101 ];
};

void operator *= ( Matrix &a, const Matrix &b )
{
    Matrix c;
    int i, j, k;
    c.n = a.n; c.m = b.m;
    for ( i = 0; i < c.n; i++ )
        for ( j = 0; j < c.m; j++ )
            for ( c.a[ i ][ j ] = k = 0; k < a.m; k++ )
                c.a[ i ][ j ] += a.a[ i ][ k ] * b.a[ k ][ j ];
    a = c;
}

void operator += ( Matrix &a, const Matrix &b )
{
    int i, j;
    for ( i = 0; i < a.n; i++ )
        for ( j = 0; j < a.m; j++ )
            a.a[ i ][ j ] += b.a[ i ][ j ];
}

int main( )
{
    int n, i, j, k;
    Matrix a, b, ret;
    while ( scanf("%d", &n) && n )
    {
        a.n = a.m = ret.n = ret.m = b.n = b.m = n;
        for ( i = 0; i < n; i++ )
            for ( j = 0; j < n; j++ )
                scanf("%lf", &a.a[ i ][ j ]);
        memset( b.a, 0, sizeof( b.a ) );
        memset( ret.a, 0, sizeof( ret.a ) );
        for ( i = 0; i < n; i++ )
            b.a[ i ][ i ] = ret.a[ i ][ i ] = 1;
        for ( i = 1; i <= 100; i++ )
        {
            b *= a;
            for ( j = 0; j < n; j++ )
                for ( k = 0; k < n; k++ )
                    b.a[ j ][ k ] /= i;
            ret += b;
        }
        for ( i = 0; i < n; i++ )
        {
            for ( j = 0; j < n; j++ )
                printf("%.2lf ", ret.a[ i ][ j ]);
            printf("\n");
        }
    }
    return 0;
}
